home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / database / clipint / clipint.asm next >
Assembly Source File  |  1987-05-16  |  2KB  |  81 lines

  1. ; CLIPINT.ASM
  2. ;
  3. ; by Michael Brill
  4. ;
  5. ;
  6.    PAGE  60,132
  7.    PUBLIC  INTERRUPT
  8.    include extenda.mac
  9.  
  10. ;***************************************************
  11. _code segment byte public
  12.  
  13. assume   cs:_code,ds:nothing,es:nothing
  14. ;---------------------------------------------------
  15. ;
  16. ;     Syntax: interrupt(interrupt number,AX,BX,CX,DX)
  17. ;
  18. ;     Return: value in AX, after the interrupt has occurred
  19. ;
  20. ;     Params: interrupt number - the interrupt (0-255) to execute
  21. ;             AX,BX,CX,DX      - values to be put into the ax-dx
  22. ;                                registers before interrupt
  23. ;
  24. ;-----------------
  25. INTERRUPT   PROC  FAR
  26.    
  27.    push  bp       ;
  28.    mov   bp,sp    ;
  29.    push  ds       ; Save Clipper's registers
  30.    push  es       ;
  31.       
  32.    get_pcount     ; How many parameters?
  33.    cmp   ax,5     ; int_num + ax,bx,cx,dx = five parameters
  34.    je    _ok      ; Yes there are five so continue
  35.    jmp   _exit    ;  no , return to clipper
  36.  
  37.  
  38.                   ; Get the values for registers
  39. _ok:
  40.    get_int  2     ; Get AX
  41.    push ax
  42.    get_int  3     ; Get BX
  43.    push ax
  44.    get_int  4     ; Get CX
  45.    push ax
  46.    get_int  5     ; Get DX
  47.    push ax
  48.    get_int  1     ; Get the interrupt number
  49.    push ax
  50.  
  51.    pop ax                              ; Get the interrupt number and poke it into
  52.    mov byte ptr CS:_intplace+1,al      ; where the int # goes to form the INT x instruction
  53.  
  54.    pop  dx        ; Grab the rest of the registers
  55.    pop  cx
  56.    pop  bx
  57.    pop  ax
  58.  
  59.  
  60. _intplace  dw 00cdH    ;  Execute the interrupt
  61.  
  62.  
  63.  
  64. _exit:
  65.    pop   es       ;
  66.    pop   ds       ; Restore Clipper's registers
  67.    pop   bp       ;
  68.  
  69.  
  70.  
  71.   ret_int  ax     ; Return the value in AX
  72.  
  73.   ret             ; Go on back to Clipper
  74.  
  75. INTERRUPT  ENDP
  76. ;-----------------------------------------------------------
  77. _code ends
  78. ;***********************************************************
  79.         END  
  80.